/**
 * 生产请求示例
 * 
 * @use
 *  
 *  import ModelFactory frm "@/models/factory"
 *  
 *  let modelInstance = ModelFactory.create({ url: 'xxx', method: 'Get' })  
 *  modelInstance.exec({ name: 'aa' }).then().catch()
 * 
 * @author Gill Gong
 */

import AbstractModel from './abstract'

export let create = function ({ url, method = 'Post', externHeaders = {}, isMockRequest }) {
  return new AbstractModel({ url, method, externHeaders, isMockRequest })
}

export let createForm = function ({ url, method = 'Post', externHeaders = {}, isMockRequest }) {
  externHeaders = Object.assign(externHeaders, {
    'Content-Type': AbstractModel.FORM_CONTENT_TYPE
  })

  return new AbstractModel({ url, method, externHeaders, isMockRequest })
}

export default {
  create,
  createForm
}

